package com.crealth.model;

import java.io.Serializable;
import java.sql.Timestamp;

import com.alibaba.fastjson.JSONObject;

public class SendBackEarnestModel implements Serializable {
	private static final long serialVersionUID = 2806L;

	private int id;  //退定金表
	private int contractID;  //合同 id
	private int productID;  //产品 id
	private int csUserID;  //客服 user id
	private Timestamp sendBackTm;  //退款日期
	private String sbAccountName;  //退款 账户姓名
	private String sbBank;  //退款 开户行
	private String sbBankAccount;  //退款 账号
	private String sbMoney;  //退款 金额
	private String sbMemo;  //退款 原因
	private int status;
	private String checkerName;  // 退款 核实人
	
	public SendBackEarnestModel() {
		contractID = 0;
		productID = 0;
		csUserID = 0;
		sendBackTm = null;
		sbAccountName = "";
		sbBank = "";
		sbBankAccount = "";
		sbMoney = "";
		sbMemo = "";
		status = 1;
		checkerName = "";
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public int getContractID() {
		return contractID;
	}
	public void setContractID(int contractID) {
		this.contractID = contractID;
	}
	public int getProductID() {
		return productID;
	}
	public void setProductID(int productID) {
		this.productID = productID;
	}
	public int getCsUserID() {
		return csUserID;
	}
	public void setCsUserID(int csUserID) {
		this.csUserID = csUserID;
	}
	public Timestamp getSendBackTm() {
		return sendBackTm;
	}
	public void setSendBackTm(Timestamp sendBackTm) {
		this.sendBackTm = sendBackTm;
	}
	public String getSbAccountName() {
		return sbAccountName;
	}
	public void setSbAccountName(String sbAccountName) {
		this.sbAccountName = sbAccountName;
	}
	public String getSbBank() {
		return sbBank;
	}
	public void setSbBank(String sbBank) {
		this.sbBank = sbBank;
	}
	public String getSbBankAccount() {
		return sbBankAccount;
	}
	public void setSbBankAccount(String sbBankAccount) {
		this.sbBankAccount = sbBankAccount;
	}
	public String getSbMoney() {
		return sbMoney;
	}
	public void setSbMoney(String sb_money) {
		this.sbMoney = sb_money;
	}
	public String getSbMemo() {
		return sbMemo;
	}
	public void setSbMemo(String sbMemo) {
		this.sbMemo = sbMemo;
	}
	public int getStatus() {
		return status;
	}
	public void setStatus(int status) {
		this.status = status;
	}	
	public String getCheckerName() {
		return checkerName;
	}
	public void setCheckerName(String checkerName) {
		this.checkerName = checkerName;
	}

	public JSONObject toJSONObject() {
		JSONObject jsonObj = new JSONObject();
		jsonObj.put("id", id);
		jsonObj.put("contractID", contractID);
		jsonObj.put("productID", productID);
		jsonObj.put("csUserID", csUserID);
		if (sendBackTm != null) {
			jsonObj.put("sendBackTm", sendBackTm.getTime() / 1000);
		}
		jsonObj.put("sbAccountName", sbAccountName);
		jsonObj.put("sbBank", sbBank);
		jsonObj.put("sbBankAccount", sbBankAccount);
		jsonObj.put("sbMoney", sbMoney);
		jsonObj.put("sbMemo", sbMemo);
		jsonObj.put("status", status);
		if (checkerName != null && checkerName.length() > 0) {
			jsonObj.put("checkerName", checkerName);
		}
		
		return jsonObj;
	}
	
	public void parseFromJson(JSONObject jsonObj) {
		if (jsonObj.containsKey("contractID")) {
			contractID = jsonObj.getIntValue("contractID");
		}
		if (jsonObj.containsKey("productID")) {
			productID = jsonObj.getIntValue("productID");
		}
		if (jsonObj.containsKey("csUserID")) {
			csUserID = jsonObj.getIntValue("csUserID");
		}
		if (jsonObj.containsKey("sendBackTm")) {
			long tm = jsonObj.getLongValue("sendBackTm");
			sendBackTm = new Timestamp(tm * 1000);
		}
		if (jsonObj.containsKey("sbAccountName")) {
			sbAccountName = jsonObj.getString("sbAccountName");
		}
		if (jsonObj.containsKey("sbBank")) {
			sbBank = jsonObj.getString("sbBank");
		}
		if (jsonObj.containsKey("sbBankAccount")) {
			sbBankAccount = jsonObj.getString("sbBankAccount");
		}
		if (jsonObj.containsKey("sbMoney")) {
			sbMoney = jsonObj.getString("sbMoney");
		}
		if (jsonObj.containsKey("sbMemo")) {
			sbMemo = jsonObj.getString("sbMemo");
		}
	}
	
	
}
